Disc drives employ buffers to allow data to be prefetched from the disc before being requested by the host computer or to temporarily hold data prior to it be written to the disc or supplied to a host computer. The buffer allows the data to be written to or read from the disc at a rate that is different than the rate at which the data is being received from or provided to the host. For streaming data, which is data that is time-sensitive because it arrives at the disc drive or must be provided from the disc drive continuously and generally without interruption, such as audio/video data received through an Institute of Electrical and Electronics Engineers (IEEE) 1394 connection, buffers are important to maintain the data continuity and the data rate desired for streaming. When more than one data stream is to be handled, buffers are essential for allowing the drive to fill the buffer faster than it will be emptied or empty the buffer faster than it will be filled so that no interruptions occur for all streams being handled.
A portion of the buffer can be filling with streaming data, while data is being paced out of the buffer at a different rate. However, the buffer size used for the steaming data must be adequate or a loss of data from the stream or a break in the stream may result. For example, when data is streaming to the disc drive, if the buffer fills before the drive can begin writing the data to the disc, then data may be lost because there is no place for it to be stored. When data is streaming from the disc drive, if the buffer empties before the disc can begin filling the buffer with more data, then there may be a break in the streaming data while the buffer must reacquire some data from the disc prior to continuing to send it to the host.
Conventionally, the amount of buffer space to use for a given stream is selected so that its size is large enough to avoid a loss of or break in the streaming data. However, this conventional determination of buffer allocation is static. The amount of buffer space allocated for a particular stream initially does not change, even though a disc drive may need to handle more than one stream at a time and streams are continuously being added and/or terminated. Maintaining a static buffer size for each stream being handled becomes inefficient because the requirements for buffering change as the number of streams and/or stream characteristics change.
Because the buffer may be used by other processes of the disc drive in addition to handling one or more data streams, any buffer space not necessary for the data streams will aid the additional processes and/or will allow additional streams to be handled. Creating a static buffer allocation for the one or more data streams may either result in an inadequate amount of buffer space for each stream, or too much buffer space will be allocated and will not be available for the additional disc drive processes or additional streams. This is especially true when the number of data streams change but the buffer allocation for each previously existing stream does not.
Accordingly there is a need for a disc drive that can dynamically allocate buffer size while handling multiple streams of data.